package instance.of.test;

public class InstanceOfMain {
	public static void main(String[] args) {
		c1 a = new c1();
		c2 b = new c2();
		c3 c = new c3();
		// This compiles and runs
		// But fails when the program is run
		// casting a super object to sub class reference 
		c2 d = (c2) a;
		System.out.println(d);
		/*
		 * System.out.println(a instanceof c1); 
		 * System.out.println(b instanceof c2);
		 *  System.out.println(c instanceof c3);
		 */
		System.out.println(c instanceof c1);
		System.out.println(b instanceof c1);
		System.out.println(c instanceof c2);
		System.out.println(a instanceof c2);

	}
}
